<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition template="/templates/templateListar.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:fn="http://java.sun.com/jsp/jstl/functions">

	<ui:define name="conteudo">
		<ui:param name="actionBean" value="#{medicoVeterinarioMB}" />

		<h:form id="frm">

			<p:hotkey bind="esc"
				handler="document.getElementById('frmTab:btnCancelar').click()" />

		</h:form>
		<h:form id="frmTab">
			<p:commandButton id="btnCancelar"
				action="#{medicoVeterinarioMB.sair}" style="display:none"
				immediate="true" value="sair"></p:commandButton>


			<p:dataTable id="tabela" var="item"
				value="#{medicoVeterinarioMB.lista}" paginator="true" rows="10"
				emptyMessage="Não há registros na lista" paginatorPosition="bottom"
				rowKey="#{item.matricula}"
				paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
				currentPageReportTemplate="(Página: {currentPage}/{totalPages})"
				rowsPerPageTemplate="10,15,25,50,100" selectionMode="single">
				<f:facet name="header">Cadastro de Médicos
					
				</f:facet>
				<p:column headerText="Matricula" style="width: 10%;"
					sortBy="#{item.funcionario.matricula}">
					<h:outputText value="#{item.matricula}" />
				</p:column>
				<p:column headerText="Nome" sortBy="#{item.dadosCadastro.nome}"
					filterBy="#{item.dadosCadastro.nome}" filterMatchMode="contains">
					<h:outputText value="#{item.dadosCadastro.nome}" />
				</p:column>

				<p:column headerText="Especialidade"
					sortBy="#{item.medico.especialidade.descricao}"
					filterBy="#{item.medico.especialidade.descricao}"
					filterMatchMode="contains">
					<h:outputText value="#{item.medico.especialidade.descricao}" />
				</p:column>

				<p:column headerText="E-mail" sortBy="#{item.dadosCadastro.email}"
					filterMatchMode="contains" filterBy="#{item.dadosCadastro.email}">
					<h:outputText value="#{item.dadosCadastro.email}" />
				</p:column>


				<p:column headerText="Cargo" sortBy="#{item.cargo.descricao}">
					<h:outputText value="#{item.cargo.descricao}" />
				</p:column>


				<p:column headerText="Ação" style="text-align:center">

					<p:commandButton actionListener="#{medicoVeterinarioMB.abrirModal}"
						styleClass="styleBotao" title="Consultar" icon="ui-icon-search"
						ajax="true" oncomplete="dialogCadastroMedico.show()"
						update=":dialogCadastro">
						<f:setPropertyActionListener value="#{item.clone()}"
							target="#{medicoVeterinarioMB.medico}" />
						<f:param name="modooperacao" value="CONSULTAR" />
					</p:commandButton>

				</p:column>


				<f:facet name="footer">
					<p:outputLabel value="Total de " />
					<p:outputLabel
						value="#{fn:length(medicoVeterinarioMB.lista)} registro(s)" />

				</f:facet>
			</p:dataTable>
		</h:form>

		<ui:include src="dialogCadastroMedico.xhtml" />
	</ui:define>
</ui:composition>
